//package com.lsec.springbootinit.config;
//
//import com.fasterxml.jackson.annotation.JsonInclude;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//
///**
// * 开发开中会查询到null值, 在转json时不希望存在null, 而是将null转换为空字符串 ""
// *
// * @author Cherry
// * @date 2023-03-03 14:42
// */
//
//@Configuration
//public class JacksonConfig {
//    @Bean
//    public ObjectMapper jacksonObjectMapper(){
//        ObjectMapper objectMapper = new ObjectMapper();
//        //null值处理 为空 /
//        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
//        objectMapper.registerModule(new JavaTimeModule());
//
//        //null值处理 为""
//        // 也可使用yml     #  jackson:defaultPropertyInclusion: NON_EMPTY
////        objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() {
////            @Override
////            public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
////                jsonGenerator.writeString("");
////            }
////        });
//
//
//        return objectMapper;
//    }
//
//}
//
